"""
模型版本 PO
"""

import utils.enum_utils as enum
from models import POBase
from my_typing import *
from utils.data_utils.special import ObjectIdStr
from utils.validator_utils.pydantic_validator.field import (
    CharField,
    NormalField,
)


class ModelVersionPO(POBase):
    """ 模型版本 | PO """

    changed: bool = NormalField(title="数据是否变更")
    model_operation: enum.ModelOperation = CharField(title="模型操作类型")
    new_data: dict = NormalField(title="新数据")
    old_data: dict = NormalField(title="老数据")
    po_id: ObjectIdStr = NormalField(title="PO ID")
    po_desc: str = NormalField(title="PO 描述")
    po_operation: enum.POOperation = CharField(title="PO 操作类型")
    request_id: StrOrNone = CharField(title="请求 ID", min_length=28, max_length=28)
    rollback_id: ObjectIdStr | None = NormalField(title="回滚 ID（Version ID）")
    rollback_desc: str = CharField(title="回滚描述")
    user_id: ObjectIdStr | None = NormalField(title="用户 ID")
